/**
 * 通用接口
 */
import type { SendCodeParams, SendCodeResult, UploadImageResult } from './types';
import { post, upload } from '@/utils/request';

enum URL {
  upload = '/common/upload',
  sendCode = '/sendCode',
}

// 图片上传
export const uploadImage = (imagePath: string) =>
  upload<UploadImageResult>({ url: URL.upload, filePath: imagePath, name: 'file' });

// 发送验证码
export const sendCode = (data: SendCodeParams) => post<SendCodeResult>({ url: URL.sendCode, data });

// 登录
export const postAuthLogin = (data: any) => post({ url: '/ma/auth/v1/login', data });
// 查询广告列表
export const postBannerList = (data: any) => post({ url: '/ma/user/v1/banner/list', data });
// 查询使用记录列表详情
export const postOrderDetail = (data: any) => post({ url: '/ma/user/v1/order/detail', data });
